package com.projecy.system.controller;

import com.projecy.common.exception.BadRequestException;
import com.projecy.common.utils.ResultUtil;
import com.projecy.logs.annotation.Log;
import com.projecy.system.model.SysUser;
import com.projecy.system.model.dto.UserDto;
import com.projecy.system.service.SysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


@RestController
@RequiredArgsConstructor
@RequestMapping("/sys")
public class SysUserController extends ResultUtil {
    @Autowired
    SysUserService userService;

    @Log("查询用户列表")
    @GetMapping("/user/table")
    public ResponseEntity<Object> queryUserTable(String blurry){
        System.out.println("查询用户列表");
        try {
            return success(true, userService.queryUserTable(blurry));
        } catch (BadRequestException e) {
            e.printStackTrace();
            return fail(false, e.getMsg());
        }
    }

}
